#ifndef CAMERAFREEFLY_H
#define CAMERAFREEFLY_H

//#include "bga/math/Vector3D.h"
#include "bga/math/Quaternion.h"

#include "bga/graphics/Camera.h"

#include <string>

/**
 * \namespace bga
 * \brief API namespace
 */
namespace bga
{

/**
 * \brief defines a freefly type of camera
 */
class BOARD_HELL_ENGINE CameraFreeFly : public Camera
{
    private:

    public:
        /**
         * Contructor
         * \param position : position of the camera
         * \param center : center of look of the camera
         * \param up : up vector of the camera
         */
        CameraFreeFly(const Vector3d& position, const Vector3d& center, const Vector3d& up);

        /**
         * Destructor
         */
        virtual ~CameraFreeFly();

        void onMouseMoved(int dmx, int dmz);
        void onKeyDown(CameraDirection::Direction key);

        /**
         * \brief translate the camera according to X axis
         * \param intensity : intensity of the move
         */
        void translateX( double intensity );

        /**
         * \brief translate the camera according to Y axis
         * \param intensity : intensity of the move
         */
        void translateY( double intensity );

        /**
         * \brief translate the camera according to Z axis
         * \param intensity : intensity of the move
         */
        void translateZ( double intensity );

        /**
         * \brief rotate the camera on an any axis
         * \param angle : angle of rotation
         * \param axisX : value of the X axis
         * \param axisY : value of the Y axis
         * \param axisZ : value of the Z axis
         */
        void rotate( double angle, double axisX, double axisY, double axisZ );

        /**
         * \brief rotate the camera on X axis
         * \param angle : angle of rotation
         */
        void rotateX( double angle );

        /**
         * \brief rotate the camera on Y axis
         * \param angle : angle of rotation
         */
        void rotateY( double angle );

        /**
         * \brief rotate the camera on Z axis
         * \param angle : angle of rotation
         */
        void rotateZ( double angle );

        virtual void buildTransformationMatrix();

        Vector3d getOrientation() const;
        Vector3d getPosition() const;

        /**
         * \brief used to know the orientation for picking... considering camera position, orientation and mouse position
         * \param orientation : current oriantation of the camera
         * \param x : x coordinate of the mouse position
         * \param y : y coordinate of the mouse position
         * \param near : near plan
         * \return the orientation from position to mouse position
         *
         * representing mouse position      sample: (0,0) represent the mouse located in the center.
         */
        Vector3d getMouseOrientation(double x, double y);
};

}

#endif // CAMERAFREEFLY_H

